package com.levy.service;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.levy.entity.Customer;

@Service
public class CustomerService {
	
	@Autowired
	private EntityManagerFactory emf;
	
	public void getListCustomers(){
//		Customer costomer = em.find(Customer.class, 1);
		
	}

	public Customer getCustomerById(int id) {
//		EntityManagerFactory emf = Persistence.createEntityManagerFactory("levy-db-persistence");
		EntityManager em = emf.createEntityManager();
		Customer customer = em.find(Customer.class, id);
		return customer;

	}
}
